﻿using QdpzWtm.Models.BaseSeting;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
using WalkingTec.Mvvm.Core;

namespace QdpzWtm.Models
{
    /// <summary>
    /// 文章管理
    /// </summary>
    public class ArticleManagement:TopBasePoco
    {

        public new int ID { get; set; }
        [Display(Name = "标题")]
        [Required(ErrorMessage = "{0}是必填项")]
        public string Title { get; set; }
        [Display(Name = "文章类型")]
        [Required(ErrorMessage = "{0}是必填项")]
        public int? ArticleManagementTypeId { get; set; }
        [Display(Name = "文章类型")]
        public ArticleManagementType ArticleManagementType { get; set; }
        [JsonConverter(typeof(JsonStringConverter))]
        [Display(Name = "文章内容")]
        [Required(ErrorMessage = "{0}是必填项")]
        public string MainContent { get; set; }

        [Display(Name = "文章作者")]
        [Required(ErrorMessage = "{0}是必填项")]
        public string Author { get; set; }
        [Display(Name = "发布时间")]
        public DateTime UpTime { get; set; }
        [Display(Name = "图片内容")]
        //定义附件列表
        public List<ArticleManagementPhoto> Photos { get; set; }


    }

    public class ArticleManagementPhoto : TopBasePoco, ISubFile
    {
        public int ArticleManagementId { get; set; }
        public ArticleManagement ArticleManagement { get; set; }
        //ISubFile定义的字段
        public Guid FileId { get; set; }
        public FileAttachment File { get; set; }
        public int Order { get; set; }
    }


}
